<script type="text/javascript">
    $(document).ready(function() {
        $("#activity_checkAll").click(function() {
            if ($(this).attr("checked") == "checked") {
                $(":checkbox").attr("checked", true);
            } else {
                $(":checkbox").attr("checked", false);
            }
        });

    });
</script> 
<legend>
    <h4>
        <?php
        echo $control->getAjaxLink(array('name' => '功能列表', 'id' => 'showEventList'), array(
            'cooker' => 'BAEvent@showEventList'
        ));
        ?>\
        <?php echo '代金券类型'; ?>
    </h4>
</legend>
<fieldset>
    <table class="table table-hover">
        <thead>
            <tr>
                <th><input type="checkbox" name="activity_checkAll" id="activity_checkAll"></th>
                <th>代金券名称</th>
                <th>代金券别名</th>
                <th>分类</th>
                <th>操作</th>
            </tr> 
        </thead>
        <tbody>
            <?php
            $voucherCooker = new BAVoucherCooker();
            foreach ($voucherTypeList as $id => $type) {
                $preVoucherType = $voucherCooker->getPreVoucherTypeFromVoucherType($id);
                $typeName = $type['name'];
                $typeAlias = $type['alias'];
                $preVoucherTypeAlias = BAVoucherCooker::getPreVoucherTypeAlias($preVoucherType);
                ?>
                <tr>
                    <td><label class="checkbox">
                            <input type="checkbox" name="subBox[]" value="<?php echo $id; ?>"> 
                        </label></td>
                    <td> <?php echo $typeName;?> </td>
                    <td> <?php echo $typeAlias;?> </td>
                    <td> <?php echo $preVoucherTypeAlias;?> </td>
                    <td>
                        <div class="row-fluid">
                            <?php
                            echo $control->getAjaxLink(array('name' => '设置', 'id' => 'addVoucherType'), array(
                                'cooker' => 'BAVoucher@showAddVoucherType',
                                'voucherTypeId' => $id,
                            ));
                            echo ' | ';
                            echo $control->getAjaxLink(array('name' => '删除', 'id' => 'DelVoucherType'), array(
                                'cooker' => 'BAVoucher@delVoucherType',
                                'voucherTypeId' => $id,
                            ));
                            ?>
                        </div>                   
                    </td>
                </tr>
    <?php }
?>
        </tbody>
    </table>
    <div class="row-fluid">
    <?php
    echo $control->getAjaxLink('添加代金券类型', array(
        'cooker' => 'BAVoucher@showChooseVoucherType',
        'htmlOptions' => array('class' => 'btn'),
    ));
    ?>
</div>
    <div class="pagination">  
        <ul>  
            <li class="active">
                <a href="javascript:void()">前一页</a>    </li>  
            <li class="active">
                <a href="javascript:void()">1</a>    </li>  
            <li class="active">
                <a href="javascript:void()">后一页</a>    </li>  
        </ul>  
    </div>
